package com.stylefeng.guns.rest.modular.wz.api.v3.service.impl;

import com.stylefeng.guns.rest.common.persistence.dao.WzCouponOrderMapper;
import com.stylefeng.guns.rest.common.persistence.dao.WzMapActivityMapper;
import com.stylefeng.guns.rest.common.persistence.model.WzCouponOrder;
import com.stylefeng.guns.rest.common.persistence.model.WzMapActivity;
import com.stylefeng.guns.rest.common.persistence.model.WzUser;
import com.stylefeng.guns.rest.common.persistence.model.WzUserFinanceRecord;
import com.stylefeng.guns.rest.modular.wz.api.v3.service.IWzMapActivityService;
import com.stylefeng.guns.rest.modular.wz.service.IWzUserFinanceRecordService;
import com.stylefeng.guns.rest.modular.wz.service.IWzUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @program: wz_dev_app_shop
 * @description: 管理员实现类
 * @author: Chenchao
 * @create: 2019-01-24 10:06
 **/
@Service
public class WzAdminServiceImplV3 {
    @Autowired
    private IWzUserFinanceRecordService userFinanceRecordService;
    @Autowired
    private IWzUserService userService;
    @Autowired
    private WzCouponOrderMapper couponOrderMapper;
    @Autowired
    private WzMapActivityMapper mapActivityMapper;

    @Transactional
    public boolean saveWzMapActivityCheckFailUseShopCoupon(WzMapActivity activity, WzCouponOrder couponOrder) {
        int r = mapActivityMapper.updateById(activity);
        if (r > 0) {
            r = couponOrderMapper.updateById(couponOrder);
            if (r > 0) {
                return true;
            }
        }
        return false;
    }

}
